package insight.jsp.custom.taglib;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

public class ButtonTagHandler extends TagSupport {
	private static final long serialVersionUID = 1L;
	private String id;
	private String title;
	private String style;
	private String onclick;

	@Override
	public int doStartTag() throws JspException {
		try {
			JspWriter out = pageContext.getOut();
			String onclickStr = onclick != null ? "onclick=\"" + onclick + "\""
					: "";
			String strOut = "<a id=\"" + id + "\" href=\"javascript:void(0)\" "
					+ "class=\"easyui-linkbutton\"" + onclickStr + ">" + title
					+ "</a>";
			out.println(strOut);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return SKIP_BODY;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getStyle() {
		return style;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	public String getOnclick() {
		return onclick;
	}

	public void setOnclick(String onclick) {
		this.onclick = onclick;
	}
}